package org.example.dao.vo;

import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import org.example.dao.entity.book.BCommodity;

/**
 * 商品导入表
 * @author 22449
 */
@Data
public class ExcelVo {

    @ExcelProperty("年级")
    private String level;
    @ExcelProperty("学院名称")
    private String kindName;
    @ExcelProperty("专业名称")
    private String master;
    @ExcelProperty("书名")
    private String name;
    @ExcelProperty("ISBN号")
    private String isbn;
    @ExcelProperty("原价")
    private Double originalCost;
    @ExcelProperty("折后价")
    private Double currentCost;
    @ExcelProperty("版本/出版社/作者（如果三者都有必须写全）")
    private String writer;
    @ExcelProperty("库存")
    private Integer stock;
    @ExcelProperty("商品详情")
    private String details;

    public BCommodity getCommodity(){
        BCommodity BCommodity = new BCommodity();
        BCommodity.setName(name);
        BCommodity.setIsbn(isbn);
        BCommodity.setOriginalCost(originalCost);
        BCommodity.setCurrentCost(currentCost);
        BCommodity.setWriter(writer);
        BCommodity.setStock(stock);
        BCommodity.setDetails(details);
        return BCommodity;
    }

    public void updateCommodity(BCommodity BCommodity){
        BCommodity.setName(name);
        BCommodity.setOriginalCost(originalCost);
        BCommodity.setCurrentCost(currentCost);
        BCommodity.setWriter(writer);
        BCommodity.setStock(stock);
        BCommodity.setDetails(details);
    }



//    public ExcelVo(Commodity commodity){
//        this.name = commodity.getName();
//        this.ISBN = commodity.getIsbn();
//        this.originalCost = commodity.getOriginalCost();
//        this.currentCost = commodity.getCurrentCost();
//    }

}
